home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / music / freq4.zip / freq.txt < prev    next >
Text File  |  1994-10-03  |  17KB  |  351 lines

  1. FILE LIST:
  2.  
  3. FREQ.EXE     executable program for PAS 16 sound cards
  4. SBFREQ.EXE   executable program for Soundblaster sound cards
  5. FREQ.TXT     (you are reading it)
  6. FREQ.INI     initialization file for FREQ.EXE/SBFREQ.EXE
  7.  
  8. FREQ.EXE:
  9.  
  10. FREQ.EXE is a program for the ProAudio Spectrum/Studio 16 sound cards.
  11. It samples the input, performs an FFT, and graphs the output.  
  12. INI file and command line options provide the user with the ability to 
  13. select linear/log frequency and amplitude scales as well as sampling rates, 
  14. length of the FFT, and windowing functions.  Graphics is done using the VGA
  15. 640x480x16 video mode, so a VGA compatible card is required.  The program will
  16. only run on computers with an 80386 or above processor.  A coprocessor is
  17. recommended, but not required.
  18.  
  19. SBFREQ.EXE:
  20.  
  21. SBFREQ.EXE is the equivalent to FREQ.EXE, except it works with 8 bit 
  22. Soundblaster and compatible cards.  It looks for the environment variable 
  23. "BLASTER=A220 I5 D1" to set the Soundblaster address, IRQ, and DMA.  If this 
  24. variable is not available, the default values (220,5,1) are used.
  25.  
  26. COMPATABILITY:
  27.  
  28. This program has been tested on the following sound cards:
  29. - ProAudio Studio (freq)
  30. - Logitech Soundman (freq)
  31. - Soundblaster 16 (sbfreq)
  32. - Soundblaster (sbfreq)
  33. - Sound Galaxy 16 NX (sbfreq)
  34. - GUS MAX (sbfreq with SBOS)
  35.  
  36. RUNNING UNDER WINDOWS:
  37.  
  38. I have had problems with running the PAS version of the program under Windows
  39. with the latest PAS drivers (MVSOUND version 3.23 or 3.24).  I don't remember 
  40. having any such problems with previous versions of the PAS drivers.  If 
  41. switching between Windows and Freq causes the screen to be messed up, use 
  42. the 'V' command to restore the display.
  43.  
  44. COMMAND LINE OPTIONS:
  45.  
  46. -Snumber sets the sampling rate.
  47. -Fnumber sets the length of the FFT.
  48. -Mnumber sets the scale maximum.
  49. -Bnumber sets the logarithmic base level (in tens of dB).
  50. -Tnumber sets the logarithmic top level (in tens of dB).
  51. -Gnumber sets the dB/octave gain factor.
  52. -Rnumber sets the reference frequency for dB/octave gains.
  53. -LA sets a logarithmic scale for the amplitude axis.
  54. -LF sets a logarithmic scale for the frequency axis.
  55. -W0 selects a Hamming window.  (offset sine) <--default
  56. -W1 selects a Hanning window.  (sine)
  57. -W2 selects a Blackman window. (two sines)
  58. -W3[,alpha] selects a Gaussian window.
  59. -W4 selects a Welch window.    (quadratic)
  60. -W5 selects a Parzen window.   (triangular)
  61. -W6 selects a Rectangular window.
  62. -Wfilename saves the windowing function to the specified file.
  63. -? or -H displays this message.
  64.  
  65. INI File options: 
  66.  
  67. These options override the program defaults, but are overridden by the 
  68. options specified on the command line.  The red,green,blue values for the
  69. colors must be values between 0 and 63.
  70.  
  71. Sample rate: 44100          ( same as -Snumber )
  72.      Valid sampling rates are 5000 Hz to 88200 Hz for PAS 16 cards.  For 
  73.      Soundblaster cards, values in the same range will be accepted, however 
  74.      for the old 8-bit Soundblaster cards (and the Soundblaster section on 
  75.      PAS cards) the sampling rate cannot exceed 12000 Hz.  Any value greater 
  76.      than this will result in a mis-labelled frequency axis.  For newer 
  77.      Soundblaster cards, sampling rates up to (and possibly beyond) 44100 Hz 
  78.      are possible.
  79. FFT length: 1024            ( same as -Fnumber )
  80.      Valid FFT lengths are from 8 to 2048.  Longer FFTs will result in slower 
  81.      display updates (maximum update rate will be SampleRate/FFTlength).  
  82.      Computers slower than 486DX-33MHz will not be able to reach the maximum 
  83.      rate because they cannot perform the calculations in the available time.
  84. Window function: 0          ( same as -Wnumber )
  85.      0 selects a Hamming window.  (offset sine) <--default
  86.      1 selects a Hanning window.  (sine)
  87.      2 selects a Blackman window. (two sines)
  88.      3 selects a Gaussian window.
  89.      4 selects a Welch window.    (quadratic)
  90.      5 selects a Parzen window.   (triangular)
  91.      6 selects a Rectangular window.
  92. Log freq scale: 0           ( 1 = -LF )
  93.      0 selects a linear frequency scale (equal distances result in equal 
  94.        frequency differences)
  95.      1 selects a logarithmic frequency scale (equal distances result in equal
  96.        frequency ratios)
  97. Log amp scale: 1            ( 1 = -LA )
  98.      0 selects a linear amplitude scale
  99.      1 selects a logarithmic (dB) amplitude scale
  100. Base db: 7                  ( same as -Bnumber )
  101.      Sets the base value for the dB amplitude scale
  102. Top db: 2                   ( same as -Tnumber )
  103.      Sets the top value for the dB amplitude scale
  104. Max amp: 1.0                ( same as -Mnumber )
  105.      Sets the top value for the linear amplitude scale
  106. DB/octave gain: 0           ( same as -Gnumber )
  107.      Valid values here are 0,3,6,9, or 12.  This option gives a frequency-
  108.      dependent boost in the displayed amplitudes.  The value specified is 
  109.      given in dB/octave.  For example, suppose there are two signals, one an 
  110.      amplitude-1.0 signal at 1kHz, and the other an amplitude-0.5 signal at 
  111.      2kHz.  Specifying 6dB/octave will result in both of these appearing at 
  112.      equal amplitudes.  Specifying 12dB/octave will result in the 2kHz 
  113.      appearing to be twice the amplitude of the 1kHz signal.  Since harmonics 
  114.      typically are reduced in amplitude proportional to 1/frequency 
  115.      (6dB/octave) or to 1/frequency^2 (12dB/octave), using this option will 
  116.      improve the visibility of the higher harmonics in a signal.
  117. Reference frequency: 1000   ( same as -Rnumber )
  118.      This specifies the frequency of 0dB gain, when a dB/octave gain factor 
  119.      is being used.
  120. Base frequency: 0
  121.      This specifies the minimum frequency displayed on the plot.  This can be 
  122.      used to zoom in on a particular section of the spectrum.
  123. Frequency factor: 1.0
  124.      This specifies the zoom-factor for the frequency axis.
  125. Decay mode: 0 
  126.      0 selects no decay mode (display what has just been sampled)
  127.      1 selects decay mode.  In this mode the values at a frequency will decay
  128.        exponentially until a new, larger value appears at this frequency.  The
  129.        decay rate can be set with the following option.
  130. Decay factor: 0.9
  131.      This value selects the rate at which the frequency bins decay in decay 
  132.      mode.  The value should be less than 1, and larger than 0.
  133. Background color: 0,0,20    ( sets the background red,green,blue value )
  134. Clipping warning color: 20,0,0 
  135.      Sets the background color set when clipping occurs.
  136.      WHY DOES THE SCREEN FLASH ALL OF THE TIME?  That is because this color 
  137.      is different from the background color.  The program changes the 
  138.      background color to this color whenever clipping of the signal is 
  139.      detected (the sampled signal hits the allowable signal limits.)  This 
  140.      clipping will result in a distortion of the frequency plot (look at the 
  141.      spectrum of a pure whistle when clipping occurs.)  The best solution to 
  142.      this problem is to lower the input level so that clipping does not occur.  
  143.      If this is not possible, you can set this color to the same value as the 
  144.      background color, and the screen will not longer flash.
  145. Graph color: 30,35,60       ( sets the color for the FFT graph )
  146. Axis label color: 50,20,45  ( sets the color frequency and amplitude labels )
  147. Border color: 40,40,40      ( sets the color for the border and tick marks )
  148. Text color: 55,55,25        ( sets the color for text (other than labels) )
  149. Cursor upper color: 20,20,20 ( sets the color for the upper half of the cursor )
  150. Cursor lower color: 63,63,63 ( sets the color for the lower half of the cursor )
  151.  
  152. RUNTIME OPTIONS:
  153.  
  154. While the program is running, the following commands may be used:
  155.  
  156. E,Q,<ESC> : Exit from the program
  157. F : Change the FFT length
  158. R : Change the sampling rate
  159. S : Save the current state to an INI file.  The default INI file is FREQ.INI, 
  160.     which will be loaded as the default options.  If a filename is given as 
  161.     the first parameter on the command line, 
  162. W : Alternate among the windowing functions
  163. P : Toggle peak display mode on/off (shows the frequency of maximum amplitude)
  164. X : Toggle between logarithmic and linear frequency (x axis) scales
  165. Y : Toggle between logarithmic (dB) and linear amplitude (y axis) scales
  166. 0 : Select 0 db/octave gain
  167. 3 : Select 3 db/octave gain
  168. 6 : Select 6 db/octave gain
  169. 9 : Select 9 db/octave gain
  170. 1,2: Select 12 db/octave gain
  171. V : Redraw the video display
  172. B : Toggle black&white/color display, useful for screen prints.  Note: if you
  173.     want to make a printout of the display, run the DOS program GRAPHICS.COM
  174.     prior to running FREQ.  Before printing, switch to the black&white display, 
  175.     and then press Shift-<PrintScreen>.  Refer to your DOS documentation for
  176.     more information on the GRAPHICS program.
  177. D : Toggle decay mode on/off.  Decay mode causes the frequency bin contents
  178.     to decay exponentially from their peak values.  The rate of decay can be
  179.     adjusted using the +/- keys.
  180. +/- : increase/decrease decay rate in decay mode
  181.  
  182. <Up> : increase the amplitude scale
  183. <Down> : decrease the amplitude scale
  184. Alt-<Up> : raise top dB level for log amplitude displays
  185. Alt-<Down> : lower top dB level for log amplitude displays
  186. <Left> : Shift frequency axis to the left (show higher frequencies)
  187. <Right> : Shift frequency axis to the right (show lower frequencies)
  188. Alt-<Left> : Contract the frequency axis
  189. Alt-<Right> : Expand the frequency axis
  190.  
  191. <space> : freeze display, put up a cursor, and put up a display of frequency,
  192. phase, and amplitude information.  In this mode, the H,J,K,L keys will move 
  193. the cursor 10-left,1-left,1-right,10-right, respectively.  Pressing <enter>
  194. will save the data to a file, with one frequency bin per line.  Each line 
  195. will contain {frequency} {real part} {imaginary part}.  This data can then 
  196. be loaded into a spreadsheet or plotting program for display.  (The FFT 
  197. magnitude is found by computing sqrt({real part}^2+{imag part}^2).)
  198. Pressing  <space> will resume data aquisition.
  199.  
  200. For PAS16 cards, the following keys are also available:
  201.  
  202. <,> Decrease/increase the microphone input level
  203. [,] Decrease/increase the external input level
  204. {.} Decrease/increase the internal (CD) input level
  205.  
  206. THE WINDOWING FUNCTION:
  207.  
  208. Several different windowing functions are available.  The windowing function
  209. is a function that is multiplied by the input data to reduce the effects of
  210. the discontinuity at the ends of the data set.  A rectangular window is
  211. actually no window: all data is passed through.  A Parzen (triangular) window
  212. uses a trianglar weighting: the end points are multiplied by 0, the
  213. middle point by 1, with a linear ramp from 0 to 1 and back to 0 again.
  214. A Welch Window uses a quadratic weighting: the end points are multiplied by
  215. 0, the middle points by 1, with a [concave down] quadratic function from 0,
  216. up to 1, and back down to 0 again. To see the shapes of the various windows,
  217. used the -Wfilename option, and plot the data in the output file.
  218.  
  219. The best way to see the effects of windows is to use a logarithmic amplitude
  220. scale, and input a sine wave (an audio test CD works great for this).  If
  221. you don't have any good sine wave sources, whistling into a mic works fairly
  222. well.
  223.  
  224. KNOWN PROBLEMS: (let me know if you find others)
  225.  
  226. 1) The PAS version of the program does not work if the 'device=mvsound.sys'
  227. line in config.sys contains the switch "u" (this switch allows initialization
  228. of the card, but then the driver is unloaded from memory (not a TSR)).
  229. Removing this switch solves the problem.  My config.sys contains the
  230. following line:
  231.    devicehigh=c:\pastudio\mvsound.sys d:5 q:10 s:1,220,1,7 j:1 t:1 v:0
  232.  
  233. 2) The actual sample rates must be integer divisions of the timer frequency,
  234. which is 1.19318 MHz for PAS cards, and 1.0 MHz for Soundblaster cards.
  235. This means actual sampling rates for PAS cards are:
  236.    91.78kHz, 85.23kHz, 79.55kHz, 74.57kHz, 70.19kHz, 66.29kHz, 62.80kHz,
  237.    59.66kHz, ... , 45.89kHz, 44.19kHz, 42.61kHz, etc.
  238. and the actual sampling rates for Soundblaster cards are:
  239.    45.45kHz, 43.48kHz, 41.67kHz, 40kHz, ... 22.73kHz, 22.22kHz, 21.74kHz, etc.
  240. The displayed sample rates will not reflect actual values unless the command
  241. line option specifies a rate that is an integral division of the timer
  242. frequency.
  243.  
  244. 3) The PAS version of the program may crash under Windows when used with
  245. newer versions of the PAS drivers.  (MVSOUND version 3.23 or 3.24.)  I don't
  246. recall having these problems with previous version of the drivers.  Also,
  247. there is the possibility, depending on the installed drivers, that the
  248. Windows mixer settings will be confused.  This can be corrected by running 
  249. the mixer program.
  250.  
  251. 4) The specified sampling rate may be above what a Soundblaster can handle. 
  252. If this occurs, the Soundblaster will sample at its maximum rate, and the 
  253. frequency axis will not reflect the true frequencies.  Typical 8 bit 
  254. Soundblasters will only handle sampling rates up to 12kHz.  Newer 
  255. Soundblasters can handle sampling rates of at least 44.1kHz, and may be able 
  256. to go beyond.
  257.  
  258.  
  259. WHAT'S NEW IN VERSION TWO:
  260.  
  261. 1) The FFT routine has been changed to process purely real data, which can be
  262. done in about half of the time it takes to process complex data.  This makes
  263. the FFT routine a little messy, but it is worth the mess!
  264.  
  265. 2) The screen updating routine was changed a bit, and now runs faster
  266. than before.  The main change was setting the mode and color once when the
  267. program starts, instead of every time a line was drawn.  This works
  268. because I am interesting in drawing one color only, and nothing else is
  269. trying to output to the display while the program is running.
  270.  
  271. 3) Changed the square root code to use a Newton-Raphson method.
  272.  
  273. 4) Filled in the gaps in plots (such as log frequency scale).
  274.  
  275. 5) A version is included which runs on only 386+ machines with COPROCESSORS.
  276. This program is even faster than the other version because it was written
  277. in 386/387 assembly code.
  278.  
  279. 6) Removed Bartlett window function (it is essentially the same as the Parzen
  280. window function).
  281.  
  282. 7) Added cursor/amplitude display during paused display.
  283.  
  284. WHAT'S NEW IN VERSION THREE:
  285.  
  286. 1) Skipped the assembly language version (it is too difficult to keep up with
  287. the changes in two versions of the program).  The version optimized for the
  288. 386 runs as fast as the eye can see, anyway, so there was not much gain it
  289. going real time.
  290.  
  291. 2) Added checking so that lines do not go beyond the limits of the display.
  292.  
  293. 3) Added options for 0,3,6,9,12 dB/octave gains so that higher harmonics can
  294. be made more visible (6dB/octave gain will make harmonics whose amplitudes
  295. drop as 1/frequency to have the same amplitude; 12dB/octave will make
  296. harmonics whose amplitudes drop as 1/frequency^2 to have the same amplitude.)
  297.  
  298. 4) Added a bunch of run-time options for modifying the display.
  299.  
  300. 5) Added more information in the header display
  301.  
  302. 6) Added an INI file for setting defaults, so that you don't have to specify
  303. all of your favorite options on the command line.
  304.  
  305. 7) Allow modification of display colors (through the FREQ.INI file).
  306.  
  307. 8) Background flashes a warning color when saturation of the input occurs.
  308. (This flashing can be disabled by setting the background color and the
  309. clipping warning color to the same values in the INI file.)
  310.  
  311. THE SCORE FOR VERSION FOUR:
  312.  
  313. 1) Added run-time commands for changing of the FFT size and sampling rate.
  314.  
  315. 2) Added a command to save the current state to an INI file.
  316.  
  317. 3) Added a command to toggle between color/black&white displays, so that
  318. screen-prints looked good on black&white printers.
  319.  
  320. 4) Added commands for zooming in on the frequency axis.
  321.  
  322. 5) Added decaying-bin display mode.
  323.  
  324. 6) Added control of mic/ext/int input levels for PAS 16 cards.
  325.  
  326. 7) Added help display.
  327.  
  328. CREDITS:
  329.  
  330. The Soundblaster code was written by Heath I. Hunnicutt (heathh@cco.caltech.edu 
  331. -or- heathh@tybalt.cco.caltech.edu).  The source for this code is also 
  332. available via FTP, but I don't remember where.
  333.  
  334. Thanks to Marko Slyz for his relentless critique of this program.  Because 
  335. of him, the user-friendliness was improved and many extra features have been 
  336. added.
  337.  
  338. The source code for a previous version of this program is available via FTP
  339. in the file FREQ3.ZIP or FREQ3.ARJ.
  340.  
  341.  
  342. If you have any questions or bug reports, you can contact me at:
  343.  
  344. Internet:    phillipv@eecs.umich.edu
  345.  
  346. Compuserve:  71214,2302
  347.  
  348. Philip VanBaren
  349. 1845 Lake Lila Dr.  Apt. C3
  350. Ann Arbor, MI  48105
  351.